import request from '@/utils/request'

// 查询动态列表
export function listTrends(query) {
  return request({
    url: '/trends/list',
    method: 'get',
    params: query
  })
}

// 查询发送人动态详细
export function getTrendsUserId(userId) {
  return request({
    url: '/trends/userId/' + userId,
    method: 'get'
  })
}

// 查询动态详细
export function getTrends(trendsId) {
  return request({
    url: '/trends/' + trendsId,
    method: 'get'
  })
}

// 新增动态
export function addTrends(data) {
  return request({
    url: '/trends',
    method: 'post',
    data: data
  })
}

// 修改动态
export function updateTrends(data) {
  return request({
    url: '/trends',
    method: 'put',
    data: data
  })
}

/**
 * 修改动态举报状态
 */
export function updateReport(trendsId, report) {
  const data = {
    trendsId,
    report
  }
  return request({
    url: '/trends/updateReport',
    method: 'put',
    data: data
  })
}

/**
 * 浏览量+1
 */
export function updateClickNumber(data) {
  return request({
    url: '/trends/updateClick',
    method: 'put',
    data: data
  })
}

/**
 * 修改动态状态
 */
export function updateStatus(data) {
  return request({
    url: '/trends/updateStatus',
    method: 'put',
    data: data
  })
}

/**
 * 点赞量+1
 */
export function updateFabulousNumber(data) {
  return request({
    url: '/trends/updateFabulous',
    method: 'put',
    data: data
  })
}

/**
 * 收藏量+1
 */
export function updateCollectionNumber(data) {
  return request({
    url: '/trends/updateCollection',
    method: 'put',
    data: data
  })
}
/**
 * 回复量+1
 */
export function updateReplyNumber(trendsId) {
  const data = {
    trendsId
  }
  return request({
    url: '/trends/updateReply',
    method: 'put',
    data: data
  })
}
/**
 * 回复量-1
 */
export function updateReplyNumberDel(trendsId) {
  const data = {
    trendsId
  }
  return request({
    url: '/trends/updateReplyDel',
    method: 'put',
    data: data
  })
}


// 删除动态
export function delTrends(trendsId) {
  return request({
    url: '/trends/' + trendsId,
    method: 'delete'
  })
}

/**
 * 批量修改动态举报状态为 1 成功
 */
export function delReport1(trendsId) {
  return request({
    url: '/trends/delReport1/' + trendsId,
    method: 'delete'
  })
}

/**
 * 批量修改动态举报状态为 2 不成功
 */
export function delReport2(trendsId) {
  return request({
    url: '/trends/delReport2/' + trendsId,
    method: 'delete'
  })
}
